package cn.educate.service;

import cn.educate.model.Video;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class VideoService {
    private static final List<Video> VIDEO_LIST = new ArrayList<>();

    static {
        // 初始化视频列表
        VIDEO_LIST.add(new Video(1, "video/video1.mp4", "视频标题1", "视频简介1"));
        VIDEO_LIST.add(new Video(2, "video/video2.mp4", "视频标题2", "视频简介2"));
        VIDEO_LIST.add(new Video(3, "video/video3.mp4", "视频标题3", "视频简介3"));
        VIDEO_LIST.add(new Video(4, "video/video4.mp4", "视频标题4", "视频简介4"));
        VIDEO_LIST.add(new Video(5, "video/video5.mp4", "视频标题5", "视频简介5"));
        VIDEO_LIST.add(new Video(6, "video/video6.mp4", "视频标题6", "视频简介6"));
        VIDEO_LIST.add(new Video(7, "video/video7.mp4", "视频标题7", "视频简介7"));
        VIDEO_LIST.add(new Video(8, "video/video8.mp4", "视频标题8", "视频简介8"));
        VIDEO_LIST.add(new Video(9, "video/video9.mp4", "视频标题9", "视频简介9"));
        VIDEO_LIST.add(new Video(10, "video/video10.mp4", "视频标题10", "视频简介10"));
        VIDEO_LIST.add(new Video(11, "video/video11.mp4", "视频标题11", "视频简介11"));
        VIDEO_LIST.add(new Video(12, "video/video12.mp4", "视频标题12", "视频简介12"));
        VIDEO_LIST.add(new Video(13, "video/video13.mp4", "视频标题13", "视频简介13"));
        VIDEO_LIST.add(new Video(14, "video/video14.mp4", "视频标题14", "视频简介14"));
//        VIDEO_LIST.add(new Video(15, "video/video15.mp4", "视频标题15", "视频简介15"));
        VIDEO_LIST.add(new Video(16, "video/video16.mp4", "视频标题16", "视频简介16"));
        VIDEO_LIST.add(new Video(17, "video/video17.mp4", "视频标题17", "视频简介17"));
        VIDEO_LIST.add(new Video(18, "video/video18.mp4", "视频标题18", "视频简介18"));
        VIDEO_LIST.add(new Video(19, "video/video19.mp4", "视频标题19", "视频简介19"));
        VIDEO_LIST.add(new Video(20, "video/video20.mp4", "视频标题20", "视频简介20"));
        VIDEO_LIST.add(new Video(21, "video/video21.mp4", "视频标题21", "视频简介21"));
        VIDEO_LIST.add(new Video(23, "video/video23.mp4", "视频标题23", "视频简介23"));
        VIDEO_LIST.add(new Video(24, "video/video24.mp4", "视频标题24", "视频简介24"));
        VIDEO_LIST.add(new Video(25, "video/video25.mp4", "视频标题25", "视频简介25"));
        VIDEO_LIST.add(new Video(26, "video/video26.mp4", "视频标题26", "视频简介26"));
        VIDEO_LIST.add(new Video(27, "video/video27.mp4", "视频标题27", "视频简介27"));
        VIDEO_LIST.add(new Video(28, "video/video28.mp4", "视频标题28", "视频简介28"));
        VIDEO_LIST.add(new Video(29, "video/video29.mp4", "视频标题29", "视频简介29"));
        VIDEO_LIST.add(new Video(30, "video/video30.mp4", "视频标题30", "视频简介30"));
        VIDEO_LIST.add(new Video(31, "video/video31.mp4", "视频标题31", "视频简介31"));
        // 添加更多视频
    }

    public List<Video> getRandomVideos(int count) {
        // 复制视频列表以避免修改原始列表
        List<Video> randomVideos = new ArrayList<>(VIDEO_LIST);
        // 打乱视频列表
        Collections.shuffle(randomVideos);
        // 返回指定数量的随机视频
        return randomVideos.subList(0, Math.min(count, randomVideos.size()));
    }
}
